<?php 
$user=$session->read('User');

$company_name="企业统计情况表";
$username=$user["name"];
$email=$user["email"];
$tel=$user["mobile"];
$sumcapital=0;
$sumsize=0;

$sumcompany=count($objcompanys);
$is_funds=0;
$is_height=0;

$achievement=0;
$compinstitution=0;
$achievementschool=0;
$compachievement_outputs=0;
$compachievement_awards=0;

$general_income=0;
$prospect=0;
$net_profit=0;
$over_taxes=0;
$qcll=0;

$apply=0;
$applyinvent=0;
$authorize=0;
$authorizeinvent=0;
$buy=0;

$compperson=0;
$dr=0;
$master=0;
$graduate=0;
$undergraduate=0;
$college=0;
$secondary=0;
$is_technical=0;
$is_rd=0;
$is_stuoversea=0;
$is_intern=0;
$intern_days=0;
$is_newgraduates=0;

$cost=0;
$research_exp=0;
$new_product=0;
$govern_funding=0;
$raised_enterprise=0;

$comptechnology=0;
$national=0;
foreach ($objcompanys as $objcompany){
	$companys=$objcompany["CompReport"];
	$companyarea = $objcompany["CompCarrierlease"];
	foreach($companyarea as $area){
		$sumsize += $area["area"];
	}
	if($companys["is_funds"]=="1"){
		$is_funds++;
	}
	if($companys["is_height"]=="1"){
		$is_height++;
	}
//	if($companys["size"]){
//		$sumsize+=$companys["size"];
//	}
	$capital=$companys["capital"];
	if($companys["cap_type"]=="1"){
		$sumcapital+=$capital*$rate;
	}else{
		$sumcapital+=$capital;
	}
	
	$objAchievement=$objcompany["Achievement"];
	$achievement+=count($objAchievement);
	if($objcompany["CompAchievement"]){
		$compachievement_outputs+=$objcompany["CompAchievement"][0]["output_achievement"];
		$compachievement_awards+=$objcompany["CompAchievement"][0]["award_achievement"];
 	}
 	
	$objCompInstitution=$objcompany["CompInstitution"];
	$compinstitution+=count($objCompInstitution);	
	foreach($objAchievement as $achievementstr){
		if($achievementstr["is_rely"]=="1"){
			$achievementschool++;
		}
	}

	$objcompeconomic=$objcompany["CompEconomic"];
	foreach($objcompeconomic as $economic){
		$general_income+=$economic["general_income"];
		$prospect+=$economic["prospect"];
		$net_profit+=$economic["net_profit"];
		$over_taxes+=$economic["over_taxes"];
		$qcll+=$economic["qcll"];
	}
	
	$objcompanypatent=$objcompany["CompanyPatent"];
	foreach($objcompanypatent as $patent){
		$state=$patent['state'];
		$type_id=$patent['type_id'];
		if($state=="0"){
			$apply++;
			if($type_id==$invent){
				$applyinvent++;
			}
		}
		if($state=="2"){
			$authorize++;
			if($type_id==$invent){
				$authorizeinvent++;
			}
		}
		if($state=="3"){
			$buy++;
		}
	}
	
	$objcompperson=$objcompany["CompPerson"];
	$compperson+=count($objcompperson);
	foreach($objcompperson as $person){
		$education=$person['education'];
		if($education=="2" || $education=="3"){
			$graduate++;
		}
		if($education=="2"){
			$dr++;
		}else if($education=="3"){
			$master++;
		}else if($education=="4"){
			$undergraduate++;
		}else if($education=="5"){
			$college++;
		}else if($education=="6"){
			$secondary++;
		}
		if($person['is_technical']){
			$is_technical++;
		}else if($person['is_rd']){
			$is_rd++;
		}else if($person['is_stuoversea']){
			$is_stuoversea++;
		}else if($person['is_intern']){
			$is_intern++;
			$intern_days+=$person['intern_days'];
		}else if($person['is_newgraduates']){
			$is_newgraduates++;
		}
	}
	
	$objcompdepcost=$objcompany["DevelopmentCost"];
	foreach($objcompdepcost as $depcost){
		$cost+=$depcost["cost"];
		$research_exp+=$depcost["research_exp"];
		$new_product+=$depcost["new_product"];
		$govern_funding+=$depcost["govern_funding"];
		$raised_enterprise+=$depcost["raised_enterprise"];
	}
	
	$objcomptechnology=$objcompany["CompTechnology"];
	$comptechnology+=count($objcomptechnology);
	foreach($objcomptechnology as $technology){
	   	 $department=$technology['department'];       
	     if(in_array($department,$departidlist)){
			  $national++;
		}
	}	
}
?>
<?php if(empty($report)){?>
<div class="right_side_operate_area">
	<div class="right_side_title left">
		<h2><?php echo $company_name;?></h2>
	</div>
    <?php
    	echo '<div class="right back_btn">';
    	$pindex="";
    	if($industry!=""){
    		$pindex="?industry=".$industry;
    	}
    	$url_explode=explode("group=", $_SERVER["QUERY_STRING"]);
		echo $html->link("导出报表","/reports/allcompany/1".$pindex."&group=".$url_explode[1]);
		echo '</div>';
	?> 
	<?php echo $this->element('reportgroup'); ?>
	<div class="term_choose_area right">
    	<a class="term_choose_btn" id="term_choose_btn" title="选择"></a>
    	<div class="screen_list" id="screen_list" style="display:none;visibility:hidden;">
    		<ul>
    			<?php 
    			foreach($industrys as $key=>$strindustry){
    				$selected="";
    				if($industry==$key){
    					$selected="selected";
    				}
    				echo '<li class="'.$selected.'">';
    				$keyindustry="";
    				if($key!=""){
    					$keyindustry="?industry=".$key;
    				}
    				echo $html->link($strindustry,"/reports/allcompany".$keyindustry,array("class"=>$selected));
    				echo '</li>';
    			}
    			?>
    		</ul>
    	</div>
    </div>
    <div class="clear"></div>
</div>
<?php }?>
<div class="right_side_scollbar">
    <div class="detail_info_panel">
    	<div class="details_info_content">
<style>
@page compinfo
	{
	margin:100px;
}
div.compinfo
	{page:compinfo;}
.compinfo{
	width:670px;font-size:9.0pt;padding-bottom:10px;font-family:"宋体";
}
.tinfo{
	margin-bottom:6px;
	padding-top:20px;
}
.tl{
	padding-left:20px;
	font-size:9.0pt;
	font-family:"宋体";height:23.0pt;line-height:23.0pt;
}
.line{
	border-bottom:1px solid #000000;height:17pt;
}

.info{
	width:100%;font-size:12px;
	border-collapse:collapse;
}
.info td,th{
	height:21pt;
}
.info .lit{
	font-weight:bold;
}
.dt{
	height:25px;
	line-height:25px;
}
.dleft{
	float:left;
}
.dright{
	float:right;
}
.xv{
	line-height:10.0pt;font-size:9.0pt;font-family:"宋体";
}
.qz{
	padding-left:17px;
}
.qzt{
	padding-left:52px;
}
</style>
<div class="compinfo">
  <!--[if gte vml 1]>
<v:rect
id="_x0000_s1027" style='position:absolute;left:0;text-align:left;
margin-left:324pt;margin-top:7.8pt;width:200px;height:66.6pt;text-indent:0;
z-index:1' filled="f" stroked="f">
<v:textbox style='mso-next-textbox:#_x0000_s1027' inset="0,0,0,0"/>
</v:rect><![endif]-->

  <div v:shape="_x0000_s1027"  style="z-index:1;position:absolute;left:460px;width:200px;">
	  <div class="xv">表    号：GZ－006F1</div>
	  <div class="xv">制表机关：科学技术部</div>
	  <div class="xv">批准机关：国家统计局</div>
	  <div class="xv">批准文号：国统制[2010]129号</div>
	  <div class="xv">有效期截止时间：2012年10月</div>
  </div>
  <div class="tinfo">
    <br/><br/><br/>
    <h3 style="text-align:center;font-weight:normal">领军人才在孵企业统计情况</h3>
    <div class="tl">
 		   机构名称（TDF8114）：<u><?php echo $str->sub_strlen($company_name,50);?></u>
     	   填表人（TDF8114）：<u><?php echo $str->sub_strlen($username,20);?></u>
    </div>
    <div class="tl">
		    联系电话（TDF8115）：<u><?php echo $str->sub_strlen($tel,24);?></u>
		    联系邮箱（TDF8116）：<u><?php echo $str->sub_strlen($email,36);?></u>
    </div>
    <div class="tl">
    	  企业总数（TDF8117）：<u><?php echo $str->sub_strlen($sumcompany,6);?></u>
		   总注册资金（TDF8118）：<u><?php echo $str->sub_strlen($sumcapital,16);?></u>
		  总孵化面积（TDF8119）：<u><?php echo $str->sub_strlen($sumsize,12);?></u>
    </div>
  </div>
  <table class="info" border="1" bordercolor="#000000" cellspacing="0" cellpadding="0">
    <tr>
      <th style="width:195px">指标</th>
      <th style="width:68px"><div align="center">代码</div></th>
      <th style="width:68px"><div align="center">数值</div></th>
      <th style="width:195px"><div align="left">指标</div></th>
      <th style="width:68px"><div align="center">代码</div></th>
      <th style="width:68px"><div align="center">数值</div></th>
    </tr>
    <tr>
      <td colspan="3" class="lit">一、企业基本概况（单位：个）</td>
      <td colspan="3" class="lit">三、企业从业人员情况（单位：人）</td>
    </tr>
    <tr>
      <td>企业登记总数</td>
      <td><div align="center">TDF8J100</div></td>
      <td><div align="center"><?php echo $str->formatquantity($sumcompany); ?></div></td>
      <td>企业从业人员数</td>
      <td><div align="center">TDF8H300</div></td>
      <td><div align="center"><?php echo $str->formatquantity($compperson); ?></div></td>
    </tr>
    <tr>
      <td>资金到位总数</td>
      <td><div align="center">TDF8J101</div></td>
      <td><div align="center"><?php echo $str->formatquantity($is_funds); ?></div></td>
      <td class="qz">其中：博士</td>
      <td><div align="center">TDF8H311</div></td>
      <td><div align="center"><?php echo $str->formatquantity($dr); ?></div></td>
    </tr>
    <tr>
      <td>经认定高新技术企业总数</td>
      <td><div align="center">TDF8J102</div></td>
      <td><div align="center"><?php echo $str->formatquantity($is_height); ?></div></td>
      <td class="qzt">硕士</td>
      <td><div align="center">TDF8H312</div></td>
      <td><div align="center"><?php echo $str->formatquantity($master); ?></div></td>
    </tr>
    <tr>
      <td>研发机构总数</td>
      <td><div align="center">TDF8J103</div></td>
      <td><div align="center"><?php echo $str->formatquantity($compinstitution); ?></div></td>
      <td class="qz">其中：研究生学历</td>
      <td><div align="center">TDF8H313</div></td>
      <td><div align="center"><?php echo $str->formatquantity($graduate); ?></div></td>
    </tr>
    <tr>
      <td>成果转化总数</td>
      <td><div align="center">TDF8J104</div></td>
      <td><div align="center"><?php echo $str->formatquantity($achievement); ?></div></td>
      <td class="qzt">本科学历</td>
      <td><div align="center">TDF8H314</div></td>
      <td><div align="center"><?php echo $str->formatquantity($undergraduate); ?></div></td>
    </tr>
    <tr>
      <td class="qz"></b>其中：依托高校数量</td>
      <td><div align="center">TDF8J105</div></td>
      <td><div align="center"><?php echo $str->formatquantity($achievementschool); ?></div></td>
      <td class="qzt">大专学历</td>
      <td><div align="center">TDF8H315</div></td>
      <td><div align="center"><?php echo $str->formatquantity($college); ?></div></td>
    </tr>
    <tr>
      <td>获奖成果总数</td>
      <td><div align="center">TDF8J106</div></td>
      <td><div align="center"><?php echo $str->formatquantity($compachievement_awards); ?></div></td>
      <td class="qzt">中专学历</td>
      <td><div align="center">TDF8H316</div></td>
      <td><div align="center"><?php echo $str->formatquantity($secondary); ?></div></td>
    </tr>
    <tr>
      <td>产出成果总数</td>
      <td><div align="center">TDF8J107</div></td>
      <td><div align="center"><?php echo $str->formatquantity($compachievement_outputs); ?></div></td>
      <td class="qz">其中：科技活动人员数</td>
      <td><div align="center">TDF8H317</div></td>
      <td><div align="center"><?php echo $str->formatquantity($is_technical); ?></div></td>
    </tr>
    <tr>
      <td colspan="3" class="lit">二、企业经济概况（单位：元/年）</td>
      <td class="qz">其中：研究与发展人员数</td>
      <td><div align="center">TDF8H318</div></td>
      <td><div align="center"><?php echo $str->formatquantity($is_rd); ?></div></td>
    </tr>
    <tr>
      <td>企业总收入</td>
      <td><div align="center">TDF8G210</div></td>
      <td><div align="center"><?php echo $str->formatquantity($general_income); ?></div></td>
      <td class="qz">其中：留学回国人员数</td>
      <td><div align="center">TDF8H319</div></td>
      <td><div align="center"><?php echo $str->formatquantity($is_stuoversea); ?></div></td>
    </tr>
    <tr>
      <td>企业工业总产值</td>
      <td><div align="center">TDF8G220</div></td>
      <td><div align="center"><?php echo $str->formatquantity($prospect); ?></div></td>
      <td>接纳大学生、研究生实习人天数</td>
      <td><div align="center">TDF8H320</div></td>
      <td><div align="center"><?php echo $str->formatquantity($intern_days); ?></div></td>
    </tr>
    <tr>
      <td>企业净利润</td>
      <td><div align="center">TDF8G230</div></td>
      <td><div align="center"><?php echo $str->formatquantity($net_profit); ?></div></td>
      <td>接纳应届毕业生就业人数</td>
      <td><div align="center">TDF8H321</div></td>
      <td><div align="center"><?php echo $str->formatquantity($is_newgraduates); ?></div></td>
    </tr>
    <tr>
      <td>企业上缴税金</td>
      <td><div align="center">TDF8G240</div></td>
      <td><div align="center"><?php echo $str->formatquantity($over_taxes); ?></div></td>
      <td colspan="3" class="lit">五、企业科技活动情况（单位：元/年）</td>
    </tr>
    <tr>
      <td>企业出口创汇</td>
      <td><div align="center">TDF8G250</div></td>
      <td><div align="center"><?php echo $str->formatquantity($qcll); ?></div></td>
      <td>承担各类计划项目数</td>
      <td><div align="center">TDF8K600</div></td>
      <td><div align="center"><?php echo $str->formatquantity($comptechnology); ?></div></td>
    </tr>
    <tr>
      <td colspan="3" class="lit">四、企业知识产权情况（单位：项）</td>
      <td class="qz">其中：国家级项目</td>
      <td><div align="center">TDF8K601</div></td>
      <td><div align="center"><?php echo $str->formatquantity($national); ?></div></td>
    </tr>
    <tr>
      <td>申请专利项数</td>
      <td><div align="center">TDF8F400</div></td>
      <td><div align="center"><?php echo $str->formatquantity($apply); ?></div></td>
      <td>科技活动经费支出总额</td>
      <td><div align="center">TDF8K610</div></td>
      <td><div align="center"><?php echo $str->formatquantity($cost); ?></div></td>
    </tr>
    <tr>
      <td class="qz">其中：发明专利</td>
      <td><div align="center">TDF8F410</div></td>
      <td><div align="center"><?php echo $str->formatquantity($applyinvent); ?></div></td>
      <td class="qz">其中：研究与试验发展支出</td>
      <td><div align="center">TDF8K620</div></td>
      <td><div align="center"><?php echo $str->formatquantity($research_exp); ?></div></td>
    </tr>
    <tr>
      <td>批准专利项数</td>
      <td><div align="center">TDF8F420</div></td>
      <td><div align="center"><?php echo $str->formatquantity($authorize); ?></div></td>
      <td class="qz">其中：新产品开发经费支出</td>
      <td><div align="center">TDF8K630</div></td>
      <td><div align="center"><?php echo $str->formatquantity($new_product); ?></div></td>
    </tr>
    <tr>
      <td class="qz">其中：发明专利</td>
      <td><div align="center">TDF8F430</div></td>
      <td><div align="center"><?php echo $str->formatquantity($authorizeinvent); ?></div></td>
      <td class="qz">其中：政府拨款</td>
      <td><div align="center">TDF8K640</div></td>
      <td><div align="center"><?php echo $str->formatquantity($govern_funding); ?></div></td>
    </tr>
    <tr>
      <td>购买国外技术专利数</td>
      <td><div align="center">TDF8F440</div></td>
      <td><div align="center"><?php echo $str->formatquantity($buy); ?></div></td>
      <td>企业自筹</td>
      <td><div align="center">TDF8K650</div></td>
      <td><div align="center"><?php echo $str->formatquantity($raised_enterprise); ?></div></td></div></td>
    </tr>
  </table>
  <div style="margin-top:5px;font-size:12px">
    <div><b>平衡关系</b>：TDF8J104≥TDF8J105 TDF8H300≥TDF8H(311+312) TDF8H300≥TDF8H(313+314+315+316)</div>
    <div style="padding-left:50px">TDF8H300≥TDF8H317≥TDF8H318 DF8H300≥TDF8H319 TDF8G210>TDF8G250*6.8</div>
    <div style="padding-left:50px">TDF8F400>TDF8F410 TDF8F420>TDF8F430 TDF8K610≥TDF8K620 TDF8K610≥TDF8K630</div>
  </div>
  <div style="margin-top:5px;">
	    企业负责人签字（盖章）：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	    报出日期：<?php echo date("Y年m月d日")?>
  </div>
</div>
		</div>
    </div>
</div>

<?php if(empty($report)){?>
<script>
function focuseEV(C,B,A){
	if(window.attachEvent){
		C.attachEvent("on"+B,A);
	}else{
		if(window.addEventListener){
			C.addEventListener(B,A,false);
		}
	}
}
focuseEV(document,"click",function(E){
	var E=E||window.event;
	var A=E.target||E.srcElement;
	var D=window.event?E.button:E.which;
	var C=G("term_choose_btn"),B=G("screen_list");
	while(A&&A!=document.body&&A.tagName.toLowerCase()!="html"){
		if(A==C){break}
		if(A==B){break}
		A=A.parentNode
	}
	if(A==B){
	}else if(A!=C){
		B.style.display="none"
			B.style.visibility="hidden"
	}else{
		if(D<2){
			B.style.display=B.style.display=="block"?"none":"block";
			B.style.visibility=B.style.visibility=="hidden"?"visible":"hidden";
		}
	}
});
</script>
<?php }?>